package com.iap.client.mediator
{
	import com.iap.client.event.UserEvent;
	import com.iap.client.view.UserView;
	
	import mx.collections.ArrayList;
	
	import org.robotlegs.mvcs.Mediator;
	
	public class UserMediator extends Mediator
	{
		[Inject]
		public var view:UserView;
		
		public function UserMediator()
		{
			super();
		}

		override public function onRegister():void
		{
			addContextListener(UserEvent.GET_LIST_RESPONSE, handleUserResponse);
			dispatch(new UserEvent(UserEvent.GET_LIST_REQUEST));
		}
		
		private function handleUserResponse(evt:UserEvent):void
		{
			view.dataProvider = new ArrayList(evt.result);
		}
	}
}